﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using ClassLibrary.DAO;

public partial class UserControl_ucDetailOrder : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        string id = Request.QueryString["id"];
        if (!IsPostBack)
        {

            TblOrderDAO orderDAO = new TblOrderDAO(Global.CONNECTION_STRING);
            DataTable dt = orderDAO.GetOrder(Global.ConvertToInt(id));
            grdShoppingCart.DataSource = dt;
            grdShoppingCart.DataBind();

            float deliveryfee = 0;
            float total = 0;
            if (dt.Rows.Count > 0)
            {
                deliveryfee = float.Parse(dt.Rows[0]["DeliveryFee"].ToString());
                total = float.Parse(dt.Rows[0]["Total"].ToString());
            }

            lblDeliveryFee.Text = deliveryfee.ToString("0,00.##");
            lblTotal.Text = (total + deliveryfee).ToString("0,00.##");
        }
    }
}
